package dao.interceptor;

import com.opensymphony.xwork2.ActionInvocation;
import com.opensymphony.xwork2.interceptor.AbstractInterceptor;

import entity.User;

public class SessionIntercepor extends AbstractInterceptor{
	@Override
	public String intercept(ActionInvocation invocation) throws Exception {
		System.out.println("sessionInterceptor");
		User user = (User) invocation.getInvocationContext().getSession().get("user");
		System.out.println(user==null);
		if (user==null) {
			return "login";
		}else {
			invocation.invoke();
			return null;
		}
	}
}
